package practice;

import java.util.Random;
import java.util.Scanner;

public class ApiPracticeDay01 {
    public static void main(String[] args) {
        String str = "0123456789abcdefghijklmnopqrstuvwxyz";
        Random random = new Random();
        String code = "";
        for (int i = 0; i < 4; i++) {
            int a = random.nextInt(str.length());
            char b = str.charAt(a);
            code += b;
        }
        System.out.println(code);
        System.out.println("请输入验证码");
        Scanner scanner = new Scanner(System.in);
        String c = scanner.nextLine();

        if (c.equals(code)) {
            System.out.println("验证通过");
        } else {
            System.out.println("验证失败");
        }
    }
}
